/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vzone.structs;

import java.util.*;

/**
 *可序列化住房类
 * @author OgretZar
 */
public class Housing extends BaseObject{

    /**
     * 默认构造函数
     */
    public Housing() {
        super();
        this.people=null;
        this.selling=true;
    }

    /**
     * 构造函数 从一个对象赋值
     * @param house 需要复制的对象
     */
    public Housing(Housing house){
        super(house.IdUuid,house.NameS,house.SaleMoneyD,house.CountI);
        this.people=house.people;
        this.selling=house.selling;
    }

    /**
     * 构造函数 无户主（房屋为空）
     * @param houseIdUuid 住房ID
     * @param houseNameS 住房名（小区名称）
     * @param saleMoneyD 售价
     * @param countIint 数量
     */
    public Housing(UUID houseIdUuid, String houseNameS,double saleMoneyD,int countIint) {
        super(houseIdUuid,houseNameS,saleMoneyD,countIint);
        this.people=null;
        this.selling=true;
    }

    /**
     * 构造函数 初始化所有过程
     * @param houseIdUuid 住房ID
     * @param houseNameS 住房名（小区名称）
     * @param saleMoneyD 售价
     * @param countIint 数量
     * @param people 户主
     */
    public Housing(UUID houseIdUuid, String houseNameS,double saleMoneyD,int countIint, BasePeople people) {
        super(houseIdUuid,houseNameS,saleMoneyD,countIint);
        this.people = people;
        if(this.people==null){
            this.selling=true;
        }else{
            this.selling=false;
        }
    }

    /**
     * 构造函数 自动生成UUID
     * @param houseNameS 住房名（小区名称）
     * @param saleMoneyD 售价
     * @param countIint 数量
     * @param people 户主
     */
     public Housing(String houseNameS,double saleMoneyD,int countIint, BasePeople people){
         super(houseNameS,saleMoneyD,countIint);
         this.people=people;
         if(this.people==null){
            this.selling=true;
        }else{
            this.selling=false;
        }
     }
 
    /**
     * 设置户主信息
     * @param people
     */
    public void setPeople(BasePeople people) {
        this.people = people;
    }

    /**
     * 获取户主信息
     * @return 户主信息
     */
    public BasePeople getPeople() {
        return people;
    }

    public void setSelling(boolean selling) {
        this.selling = selling;
    }
    public boolean isSelling() {
        return selling;
    }
    
    /**
     * 判断房屋是否为空
     * @return true表示没有住户false有住户
     */
    public boolean isVacant(){
        if(people==null){
            return true;
        }
        return false;
    }

    // Variables declaration - do not modify
    /**
     * 户主
     */
    private BasePeople people;

    /**
     * 判断房租是否在出售 true表示正在出售
     */
    private boolean selling;

}
